package cn.simonfish.carrier.controller;

import cn.simonfish.carrier.common.LoginInfo;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Model;

import java.util.Date;

/**
 * Created by simon on 2017/9/19.
 */
public class BaseController extends Controller {

    protected void initUserInfo(Model model){
        LoginInfo loginInfo = getSessionAttr(LoginInfo.SESSION_LOGIN);
        model.set("user_id",loginInfo.getUserId());
        model.set("user_phone",loginInfo.getPhone());
        model.set("create_time",new Date());
    }

    protected LoginInfo getLoginInfo(){
        return (LoginInfo)getSessionAttr(LoginInfo.SESSION_LOGIN);
    }
}
